Skip to content

Fix intermittent Mermaid rendering failures#40

Merged
felipefdl merged 1 commit intomainfrom
fix/mermaid-rendering
Feb 13, 2026
Merged

Fix intermittent Mermaid rendering failures#40
felipefdl merged 1 commit intomainfrom
fix/mermaid-rendering

Conversation

@felipefdl
Copy link
Member

Summary

  • Remove custom src/theme/Mermaid.tsx swizzle that caused ~20% blank/broken diagrams due to race conditions (startOnLoad: true + contentLoaded() in empty-dep useEffect)
  • Restore the official @docusaurus/theme-mermaid component which uses mermaid.render() with proper React lifecycle
  • Convert <Mermaid chart={...}/> JSX to idiomatic ```mermaid code fences
  • Update CSS selectors from .mermaid to .docusaurus-mermaid-container (the official component's wrapper class)
  • Move font configuration from CSS overrides into mermaid themeVariables so node sizes are calculated correctly during rendering (prevents text truncation)

Test plan

  • npm run build passes
  • TagoTiP/S specification page renders all Mermaid diagrams correctly
  • TagoCore plugin lifecycle page renders sequence diagrams
  • TagoCore module payload encoder page renders flow diagram
  • Refresh pages 10+ times to confirm intermittent failures are gone
  • Verify both light and dark mode

Remove custom Mermaid swizzle that had race conditions (startOnLoad +
contentLoaded in empty-dep useEffect). The official @docusaurus/theme-mermaid
component handles rendering correctly via mermaid.render() with proper
React lifecycle management.

- Delete src/theme/Mermaid.tsx and src/components/mermaid.tsx
- Convert <Mermaid chart={}/> JSX to ```mermaid code fences
- Remove Mermaid lazy wrapper from MDXComponents
- Update CSS selectors from .mermaid to .docusaurus-mermaid-container
- Move font config to mermaid themeVariables so node sizes are calculated
  correctly during rendering
@felipefdl felipefdl force-pushed the fix/mermaid-rendering branch from e21919d to ec23dfa Compare February 13, 2026 00:02
@felipefdl felipefdl merged commit b442bc4 into main Feb 13, 2026
1 check failed
@felipefdl felipefdl deleted the fix/mermaid-rendering branch February 13, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant